package com.shiwaixiangcun.customer.module.housebutler;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shiwaixiangcun.customer.R;
import com.shiwaixiangcun.customer.utils.DateUtil;

import java.util.List;

/**
 * Author   Administrator
 * Date     2018/1/26
 * Desc     eg
 * <p>
 * 服务记录
 *
 * @author Administrator
 */

public class AdapterServiceRecord extends BaseQuickAdapter<ServiceRecordEntity, BaseViewHolder> {
    public AdapterServiceRecord(@Nullable List<ServiceRecordEntity> data) {
        super(R.layout.item_service_record, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ServiceRecordEntity item) {
        helper.setText(R.id.tv_number, item.getNumber() + "");
        helper.setText(R.id.tv_content, item.getContent());
        switch (item.getStatus()) {
            case "ACCEPTED":
                helper.setBackgroundRes(R.id.tv_stature, R.drawable.shape_stature_green);
                helper.setText(R.id.tv_stature, "受理中");
                break;
            case "FINISHED":
                helper.setBackgroundRes(R.id.tv_stature, R.drawable.shape_stature_gray);
                helper.setText(R.id.tv_stature, "已完成");
                break;

            default:
                helper.setBackgroundRes(R.id.tv_stature, R.drawable.shape_stature_green);
                helper.setText(R.id.tv_stature, "受理中");
                break;
        }
        helper.setText(R.id.tv_date, DateUtil.INSTANCE.getTimeFormatString(item.getCreateTime()));
    }
}
